<?
	include('chksession.php');
	session_start();
    $data = file_get_contents("php://input");
    $objData = json_decode($data);
		$msg='';
	   $bankname= $objData->bankname ;
	   $address= $objData->address ;
	   $city= $objData->city ;
	   $enteredby=$_SESSION['username'];
		include('conn.php');
		$sqlc="select count(*) cnt from bankmast where status = 0 and bankname='".$bankname."'";
		$resc=mysql_query($sqlc);
		$rowc=mysql_fetch_assoc($resc);
		if (strlen($bankname)>1)
		{
			if($rowc['cnt']==0)
			{
				$sql="insert into bankmast(bankname,address,city,enteredby,entrydt)
					values('".strtoupper($bankname)."','".strtoupper($address)."','".strtoupper($city)."','".$enteredby."',sysdate())";
				$res=mysql_query($sql);
				if($res)
					$msg='Record saved successfully';
			}
			else
			{
					$msg='Record Already Exist';			
			}
		}
		else
		{
			$msg='Blank Bank Name not Allowed';
		}			
	    echo $msg;
?>